package WaiBao;

import java.util.Arrays;

public class ZhaoXiangYun {
    public static void main(String[] args) {
        String[] name = {"文垫(班长)","邱半兵(团支书)", "小李(学习委员)","凌源(文艺委员)", "刘楼军", "石担路", "蔡庄", "薛胜堂", "区来波", "王瀚基", "宁浩", "卫劲旅",
                "骆李", "刘志武", "钱表", "凌曼", "杨奥西", "夏夏", "赵越", "江耿涛", "王大明", "吕微笑", "刘欢喜", "潇潇", "梁子", "陆毅", "成濑", "孙曦",
                "奕星", "赵香云(学生)"};//考生本人: 赵香云(学生)
        int[] age = {20, 18, 18, 17, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 19};//最后一位：考生年龄:19

        double[] score1 = {78, 72, 78, 86, 74, 79, 78, 89, 81, 90, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 95};
        double[] score2 = {77, 84, 88, 86, 78, 97, 98, 69, 70, 90, 90, 77, 66, 85, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 94};
        double[] score3 = {82, 69, 82, 91, 78, 89, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};


        double iphone ;//代表每个学生的总分
        double oppo;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            iphone  = score1[i] +score2[i] + score3[i];
//            oppo = (iphone * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + iphone);
//            System.out.println(name[i] + "的平均分为:" + oppo);
//        }


        double qiufenshu = 0,qiupingjun= 0;
        double[]  abc  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            qiufenshu = score1[i] +  score2[i] + score3[i];
//            qiupingjun = (qiufenshu* 1.0) / 3;
//            abc [i] =qiupingjun;
//        }
//
//        for (int i = 0; i < abc.length - 1; i++) {
//            for (int j = 0; j <  abc .length - i - 1; j++) {
//                if (abc [j] < abc [j + 1]) {
//                    double tep = abc [j];
//                    abc[j] = abc [j + 1];
//                    abc[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(abc[i]);
//        }



        double rose1 = 0,  rose2 = 0, rose3 = 0;//计算每门课的平均分
        double tulip1 = 0, tulip2 = 0,tulip3 = 0;//计算每门课标准差
        double canna1 = 0, canna2 = 0,canna3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < score1.length; i++) {
            he += score1[i];
        }
        rose1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + rose1);
        double Sum = 0;
        for (int i = 0; i < score2.length; i++) {
            Sum +=score2[i];
        }
        rose2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + rose2);
        double sum = 0;
        for (int i = 0; i < score3.length; i++) {
            sum +=score3[i];
        }
        rose3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" +  rose3);



        double c1 = 0, c2 = 0, c4 = 0;
        for (int i = 0; i <score1.length; i++) {
            c1 += (score1[i] -  rose1) * (score1[i] - rose1);
        }
        tulip1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + tulip1);
        for (int i = 0; i < score2.length; i++) {
            c2 += (score2[i] -  rose2) * (score2[i] - rose2);
        }
        tulip2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +tulip2);

        for (int i = 0; i <score3.length; i++) {
            c4 += (score3[i] -  rose3) * (score3[i] -  rose3);
        }
        tulip3 = Math.sqrt(c4*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + tulip3);
//////
//////
        Arrays.sort(score1);
        Arrays.sort(score2);
        Arrays.sort(score3);
        canna1 = (score1[14] + score1[15]) * 1.0 / 2;
        canna2 = (score2[14] +score2[15]) * 1.0 / 2;
        canna3 = (score3[14] + score3[15]) * 1.0 / 2;
        System.out.println("农业设施及环境调控的中位数为:" +  canna1);
        System.out.println("农业设施设计与制造的中位数为:" +  canna2);
        System.out.println("园艺植物设施栽培学的中位数为:" +  canna3);


    }
}
